<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        class Compute{
            constructor(name,price){
                this.name = name;
                this.price = price;
            }
            sayName(){
                console.log(this.name);
            }
        }
        class Apple extends Compute{
            constructor(name,price,skill){
                // 在继承的构造函数中super必须放在第一行
                // super 可以继承父类中的方法和属性
                super(name,price);
                this.skill = skill
            }
        }
        var a = new Apple("苹果",8888,"exllence");
        console.log(a);//Apple {name: '苹果', price: 8888, skill: 'exllence'}
        a.sayName()  //苹果
    </script>
</body>
</html>